#include "device.h"

// 默认构造函数
Device::Device()
    : deviceId(-1), name(""), type(""), location(""), manufacturer(""), model(""), installationDate(QDate::currentDate())
{
}

// 参数化构造函数
Device::Device(const QString &name, const QString &type, const QString &location, const QString &manufacturer, const QString &model, const QDate &installationDate)
    : deviceId(-1), name(name), type(type), location(location), manufacturer(manufacturer), model(model), installationDate(installationDate)
{
}

// 复制构造函数
Device::Device(const Device &other)
    : deviceId(other.deviceId), name(other.name), type(other.type), location(other.location), manufacturer(other.manufacturer), model(other.model), installationDate(other.installationDate)
{
}

// 赋值操作符
Device& Device::operator=(const Device &other)
{
    if (this != &other) {
        deviceId = other.deviceId;
        name = other.name;
        type = other.type;
        location = other.location;
        manufacturer = other.manufacturer;
        model = other.model;
        installationDate = other.installationDate;
    }
    return *this;
}

// 获取设备ID
int Device::getDeviceId() const
{
    return deviceId;
}

// 设置设备ID
void Device::setDeviceId(int id)
{
    deviceId = id;
}

// 获取设备名称
QString Device::getName() const
{
    return name;
}

// 设置设备名称
void Device::setName(const QString &name)
{
    this->name = name;
}

// 获取设备类型
QString Device::getType() const
{
    return type;
}

// 设置设备类型
void Device::setType(const QString &type)
{
    this->type = type;
}

// 获取设备位置
QString Device::getLocation() const
{
    return location;
}

// 设置设备位置
void Device::setLocation(const QString &location)
{
    this->location = location;
}

// 获取设备制造商
QString Device::getManufacturer() const
{
    return manufacturer;
}

// 设置设备制造商
void Device::setManufacturer(const QString &manufacturer)
{
    this->manufacturer = manufacturer;
}

// 获取设备型号
QString Device::getModel() const
{
    return model;
}

// 设置设备型号
void Device::setModel(const QString &model)
{
    this->model = model;
}

// 获取设备安装日期
QDate Device::getInstallationDate() const
{
    return installationDate;
}

// 设置设备安装日期
void Device::setInstallationDate(const QDate &date)
{
    installationDate = date;
}
